home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / thor / deleterange.thor < prev    next >
Text File  |  1996-11-10  |  2KB  |  96 lines

  1. /* DeleteRange.thor by Troels Walsted Hansen <troelsh@powertech.no>
  2. ** $VER: DeleteRange.thor v1.00 (24.07.95)
  3. **
  4. ** Delete a specified range of messages.
  5. */
  6.  
  7. options results
  8.  
  9. /* needs THOR and bbsread.library functions */
  10.  
  11. p = ' ' || address() || ' ' || show('P',,)
  12. thorport = pos(' THOR.',p)
  13.  
  14. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  15. else
  16. do
  17.     say 'No THOR port found!'
  18.     exit 10
  19. end
  20.  
  21. if ~show('p', 'BBSREAD') then
  22. do
  23.     address command
  24.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  25.         "WaitForPort BBSREAD"
  26. end
  27.  
  28. /* get info on messages */
  29.  
  30. address(bbsread)
  31. GETGLOBALDATA stem GLOBALDATA
  32.  
  33. address(thorport)
  34. GETGLOBALCONFIG stem GLOBALCONFIG
  35. CURRENTBBS stem CURRENT
  36.  
  37. if(CURRENT.CONFNAME = "") then
  38. do
  39.     address(bbsread)
  40.         GETCONFLIST '"'CURRENT.BBSNAME'"' CONFLIST
  41.     if(rc ~= 0) then
  42.     do
  43.         address(thorport)
  44.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  45.         exit 5
  46.     end
  47.  
  48.     address(thorport)
  49.     REQUESTLIST instem CONFLIST title '"Select conf:"' SIZEGADGET
  50.     if(rc ~= 0) then exit
  51.     else CURRENT.CONFNAME = result
  52. end
  53.  
  54. address(bbsread)
  55. GETCONFDATA bbsname '"'CURRENT.BBSNAME'"' confname '"'CURRENT.CONFNAME'"' stem CONFDATA
  56.  
  57. if(CONFDATA.FIRSTMSG < 1 | CONFDATA.LASTMSG < 1) then exit
  58.  
  59. address(thorport)
  60. REQUESTINTEGER MIN '"'CONFDATA.FIRSTMSG'"' MAX '"'CONFDATA.LASTMSG'"' INIT '"'CONFDATA.FIRSTMSG'"' TITLE '"First message in range:"' BT '"_Ok|_Cancel"'
  61. firstmsg = result
  62. if(rc ~= 0 | firstmsg = "RESULT") then exit
  63.  
  64. REQUESTINTEGER MIN '"'firstmsg'"' MAX '"'CONFDATA.LASTMSG'"' INIT '"'CONFDATA.LASTMSG'"' TITLE '"Last message in range:"' BT '"_Ok|_Cancel"'
  65. lastmsg = result
  66. if(rc ~= 0 | lastmsg = "RESULT") then exit
  67.  
  68. /* delete the messages with a progressbar */
  69.  
  70. OPENPROGRESS TITLE '"' || 'Deleting messages from ' || CURRENT.CONFNAME || '"' TOTAL lastmsg-firstmsg+1 AT '"_Abort"'
  71. if(rc = 0) then
  72. do
  73.     window = result
  74.  
  75.     do i=firstmsg to lastmsg
  76.         address(thorport)
  77.         UPDATEPROGRESS REQ window CURRENT i-firstmsg+1 PT '"' || 'Deleting message #' || i || '"'
  78.         if(rc ~= 0) then
  79.         do
  80.             address(thorport)
  81.             CLOSEPROGRESS REQ window
  82.             exit
  83.         end
  84.  
  85.         address(bbsread)
  86.         UPDATEBRMESSAGE '"'CURRENT.BBSNAME'"' '"'CURRENT.CONFNAME'"' i SETDELETED
  87.     end
  88. end
  89.  
  90. address(thorport)
  91. CLOSEPROGRESS REQ window
  92. SHOWCONFERENCE '"'CURRENT.CONFNAME'"'
  93. UPDATECONFWINDOW
  94.  
  95. exit
  96.